// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include "globals.h"

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
		g_hInst = hModule;
		if (!InitializeCriticalSectionAndSpinCount(&g_cs, 0))
		{
			DebugPrintfW(_T("failed to initlize Crittical section. dwError=%d \n"),::GetLastError());
            return FALSE;
		}
		break;
	case DLL_THREAD_ATTACH:
		break;
	case DLL_THREAD_DETACH:
		break;
	case DLL_PROCESS_DETACH:
		DeleteCriticalSection(&g_cs);
		break;
	}
	return TRUE;
}

